package onlinecalsys.server.objects;

import java.util.Calendar;
import java.util.GregorianCalendar;

public class CalsysAppointment implements Appointment {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4665846024642786620L;
	private String appointment;
	private CalsysCalendar cal;
	private String username;
	private int id;

	public CalsysAppointment(String username, String appointment, CalsysCalendar cal) {
		this.appointment = appointment;
		this.cal = cal;
		this.username = username;

	}
	
	public CalsysAppointment(String username, String appointment, CalsysCalendar cal, int id) {
		this.appointment = appointment;
		this.cal = cal;
		this.username = username;
		this.id = id;

	}

	@Override
	public String getAppointment() {
		return appointment;
	}

	@Override
	public CalsysCalendar getCalendar() {
		return cal;
	}

	@Override
	public int getDay() {
		return cal.getDay();
	}

	@Override
	public int getHour() {
		return cal.getHour();
	}

	@Override
	public int getMonth() {
		return cal.getMonth();
	}

	@Override
	public int getYear() {
		return cal.getYear();
	}

	public String getUsername() {
		return username;
	}

	public String getShortDateRep() {
		if(cal.getDay() < 10) {
			return "0" +  cal.getDay() + "/" + cal.getMonth() + "/" + cal.getYear();
		}else if (cal.getMonth() < 10) {
			return cal.getDay() + "/" + "0" + cal.getMonth() + "/" + cal.getYear();
		} else if (cal.getDay() < 10 && cal.getMonth() < 10) {
			return "0" + cal.getDay() + "/" + "0" + cal.getMonth() + "/" + cal.getYear();
		} else {
			return cal.getDay() + "/" + cal.getMonth() + "/" + cal.getYear();
		}
			
	}

	@Override
	public int getAppointmentId() {
		return id;
	}

}
